package com.share.device.controller;

import com.share.common.core.web.controller.BaseController;
import com.share.common.core.web.domain.AjaxResult;
import com.share.common.log.annotation.Log;
import com.share.device.constant.DeviceConstants;
import com.share.device.service.IDeviceService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author ZhouShuang
 * @version 17
 * @Title
 * @date 2025/10/13 下午11:17
 */
@Tag(name = "设备接口管理")
@RestController
@RequestMapping("/device")
@RequiredArgsConstructor
public class DeviceController  extends BaseController {
    private final IDeviceService deviceService;

    /**
     * 获取附近站点的信息列表
     * @param latitude
     * @param longitude
     * @return
     */
    @Operation(summary = "获取附近站点的信息列表")
    @Log(title = "设备")
    @GetMapping("/nearbyStationList/{latitude}/{longitude}")
    public AjaxResult nearByStationList(@PathVariable String latitude, @PathVariable String longitude){
            return success(deviceService.nearByStationList(latitude,longitude, DeviceConstants.SEARCH_PC_RADIUS));
    }

    /**
     * 扫码充电
     * @param cabinetNo
     * @return
     */
    @Operation(summary = "扫码充电")
    @GetMapping("/scanCharge/{cabinetNo}")
    public AjaxResult scanCharge(@PathVariable String cabinetNo){
        return success(deviceService.scanCharge(cabinetNo));
    }
}
